﻿using UnityEngine;
using System.Collections;

namespace Hont.UMotionGraph
{
    public class MGPlainEffector : MoGraphEffector
    {
        public Vector3 positionOffset = Vector3.one;
        Vector3[] offsetArr;


        public override void Init(IMoGraphContainer container)
        {
            base.Init(container);

            offsetArr = new Vector3[container.Count];
        }

        protected override void Update()
        {
            if (!mIsInited) return;

            for (int i = 0; i < offsetArr.Length; i++)
            {
                offsetArr[i] = positionOffset;
            }

            base.Update();
        }

        public override Vector3 Execute(int inx, Vector3 inValue, float fallOffProportion)
        {
            return inValue + offsetArr[inx] * fallOffProportion;
        }
    }
}
